int moveElementBackward<T>(List<T> list, T element) {
  int i = list.indexOf(element);
  if (i != -1 && i < list.length - 1) {
    final tmp = list[i + 1];
    list[i + 1] = list[i];
    list[i] = tmp;
    return i + 1;
  }
  return i;
}

int moveElementToLast<T>(List<T> list, T element) {
  int i = list.indexOf(element);
  if (i != -1 && i < list.length - 1) {
    final item = list.removeAt(i);
    list.add(item);
    return list.length - 1;
  }
  return i;
}
